/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/22
 * Time:14:19
 **/
public class Main1 {

    /**
     * 每日一题-奇数位上都是奇数或者偶数位上都是偶数
     *
     * @param arr
     */
    public void oddInOddEvenInEven(int[] arr) {
        int m = 0;//偶数位
        int n = 1;//奇数位

        while (m < arr.length && n < arr.length) {
            if (arr[m] % 2 == 0) {//表示偶数位为偶数
                m += 2;
                continue;
            }
            if (arr[n] % 2 == 1) {//表示奇数位为奇数
                n += 2;
                continue;
            }
            //走到这，说明偶数位为奇数，奇数位为偶数
            int tmp = arr[m];
            arr[m] = arr[n];
            arr[n] = tmp;
        }
    }
}
